<?php

/**
 * 
 * Sun CMS
 * 
 * @author			Burning
 * @copyright		Copyright (c) 2009, IsunCms.Com.
 * @license			http://www.isuncms.com/license.htm
 * @link				http://www.isuncms.com/
 * @since				Version 1.0 Beta
 * 
 */

//定义后台
define( 'SUN_ADMIN', true );

require_once( dirname( strtr(__FILE__, '\\', '/') ).'/include/common.inc.php' );

require_once( dirname( strtr(__FILE__, '\\', '/') ).'/include/admin.func.php' );

$module = get_post( 'm' ); 

$module = $module ? strtolower( $module ) : 'platform';

$action = get_post( 'a' ); 

$action = $action? strtolower( $action ) : 'home';

$do = get_post( 'do' ); 

$do = $do ? strtolower( $do ) : 'index';

$force_login = false;

if( $force_login || ( isset( $slogin['admin'] ) && $slogin['admin'] ) )
{
	$module_array = array( 'document', 'site', 'data', 'stat', 'resource', 'platform', 'helper' );
	if( in_array( $module, $module_array ) )
	{
		if( in_array( $action, array( 'home', 'login', 'dialog' ) ) || isset( $group_priv[$module][$action] ) && $group_priv[$module][$action] )
		{
			require_once( SUNCMS.'module/'.$module.'/'.$action.'.php' );
		}
		else
		{
			alert( '您所在用户组没有权限执行该操作！' );
			go_back();
		}
	}
	else
	{
		alert( '未知应用模块！' );
		go_back();
	}
}
else
{
	strpos( CURRENT_URL, '?m=' ) && !strpos( CURRENT_URL, '?m=platform&a=login' ) && set_cookie( 'current_url', array( 'url' => CURRENT_URL, 'time' => 300 ) );
	require_once( SUNCMS.'module/platform/login.php' );
}

$outputs = ob_get_contents();
echo ob_contents( $outputs );